package com.edu4java.minitennis5;


import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Rectangle;

public class Racquet1 {
	int y = 50;
	int ya = 1;
	int X = 20;
	
	private Game game;

	public Racquet1(Game game) {
		this.game= game;
	}

	public void move() {
		if (y + ya < 0)
			ya = 1;
		if (y + ya > game.getHeight() - 10)
			ya = -1;

		y = y + ya;
	}

	public void paint(Graphics2D g) {
		
		g.fillRect(X, y, 60, 10);
		g.setColor(Color.GREEN);
	}

	public Rectangle getBounds() {
		return new Rectangle(X, y, 60, 10);
	}

	public int getTopX() {
		return X+60;
	}
}

